package com.autotest1109;

import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.edge.EdgeOptions;

/**
 * Created with IntelliJ IEDA.
 * Description:
 * User:86186
 * Date:2023-11-09
 * Time:21:34
 */
public class FirstAutotest {
    // 百度关键字搜索关键词“迪丽热巴”
    public void direbaTest() throws InterruptedException {
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--remote-allow-origins=*");
        ChromeDriver driver = new ChromeDriver(options);
        Thread.sleep(1000);
        // 在浏览器中输入百度网址，访问百度首页
        driver.get("https://www.baidu.com");
        Thread.sleep(1000);
        // 找到百度首页输入框元素,并输入关键词“迪丽热巴”
        driver.findElement(By.cssSelector("#kw")).sendKeys("刘亦菲");
        Thread.sleep(1000);
        // 找到百度首页百度一下按钮，并点击
        driver.findElement(By.cssSelector("#su")).click();
        Thread.sleep(1000);
        // 结束会话,关闭浏览器
        driver.quit();
    }
}
